package com.itheima.d2_buffered_stream;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

/**
 * 目标：掌握字符缓冲输出流的用法。
 */

//new line()根据系统指定最合适的换行符号
public class Test3BufferedWriter {
    public static void main(String[] args) {
        try( FileWriter fw = new FileWriter("day10io-app2/file/shi.txt");
              BufferedWriter bw = new BufferedWriter(fw)) {
            bw.write("《静夜思》");
            bw.newLine();
            bw.write("\t唐 李白");
            bw.newLine();
            bw.write("床前明月光");
            bw.newLine();
            bw.write("疑是地上霜");
            bw.newLine();
            bw.write("举头望明月");
            bw.newLine();
            bw.write("低头思樊宝");
            bw.newLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
